<?php

class AutoUidBehavior extends CActiveRecordBehavior {
	public $uid = 'uid';
	public $val = '';
	public function beforeValidate($event) {
		$this->owner->{$this->uid} = empty($this->val) ? Yii::app()->adminUser->id : $this->val;
	}
}

?>